#include <QFile>
#include <QString>
#include <QRegExp>

int main(int argc, char **argv)
{
	 QFile file("list.files");
     if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
         return 0;

     while (!file.atEnd()) {
		QString filename = file.readLine();
		//monierv1.pl?key=pur&filder=slp1
		QFile file2("./"+filename.left(filename.length()-1));
		if (!file2.open(QIODevice::ReadOnly | QIODevice::Text))         {
			return 0;
		}
		while(!file2.atEnd()) {
        QString line = file2.readLine();
		int count = 1;
		int j = 0;
		 while ((j = line.indexOf("<span class='greek'>") )!= -1) {
		 	QString tmp = line.right(line.length()-j); 
			int e = tmp.indexOf("</span>");
			tmp = tmp.left(e);
			line = line.right(line.length()-j-tmp.length());
			tmp = tmp.right(tmp.length()-20);
        	QString key = filename.left(filename.length()-13);
        	key = key.right(key.length()-16);
        	fprintf(stderr,"%s:" ,key.toStdString().c_str());        
			fprintf(stderr,"%s:",tmp.toStdString().c_str());
			fprintf(stderr,"%d\n",count);
			count ++;
     	 }
		}
     }
     return 0;
}
